package com.xxd.gulimail.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.xxd.common.validator.group.AddGroup;
import com.xxd.common.validator.group.ListValue;
import com.xxd.common.validator.group.UpdataGroup;
import com.xxd.common.validator.group.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌
 *
 * @author xxd
 * @email 2132862687@qq.com
 * @date 2022-09-26 10:32:57
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @NotNull(message = "修改必须指定id" ,groups ={UpdataGroup.class,UpdateStatusGroup.class} )
    @Null(message = "新增不需要id",groups = {AddGroup.class})
    @TableId
    private Long brandId;
    /**
     * 品牌名
     *  @NotBlank 不能为null,且必须包含一个非空格字符,通过@Vaild通知springmvc开启验证（  public R save(@Valid  @RequestBody BrandEntity brand) {）
     */
    @NotBlank(message = "品牌名不能为空",groups = {AddGroup.class,UpdataGroup.class})
    private String name;
    /**
     * 品牌logo地址
     */
    @NotEmpty(groups = {AddGroup.class})
    @URL(message = "logo必须为一个合法的url地址",groups = {AddGroup.class,UpdataGroup.class})
    private String logo;
    /**
     * 介绍
     */
    @NotEmpty(groups = {AddGroup.class})
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(groups = {AddGroup.class, UpdateStatusGroup.class})
    @ListValue(values={0,1},groups = {AddGroup.class,UpdataGroup.class,UpdateStatusGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */

    @NotNull(groups = {AddGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是个字母",groups = {AddGroup.class,UpdataGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(groups = {AddGroup.class})
    @Min(value = 0,message = "排序字段必须大于等于0",groups = {AddGroup.class,UpdataGroup.class})
    private Integer sort;

}
